package com.btcode.web.core.controller;

import com.btcode.common.AbstractSingleton;
import com.btcode.web.core.respone.JsonRespone;
import com.btcode.web.core.respone.ResultFlag;
import com.btcode.web.core.unit.WebContext;
import java.io.IOException;

public abstract class Controller {

    /**
     * 废弃，不得再用这个方法
     */
    @Deprecated
    public void outputMsg(String msg) throws IOException {
        if (msg == null) {
            return;
        }
        WebContext.getResponse().getWriter().write(msg);
        WebContext.getResponse().getWriter().flush();
    }


    public void success(Object obj) throws IOException {
        AbstractSingleton.getInstance(JsonRespone.class).outputObj(obj, ResultFlag.SUCCESS,
                                                                   "WELL DONE");
    }

}
